<?php
class Message
{
	private $recipients = array();
	private $subject;
	private $messageBody = "";
	private $styles = array();
	private $from;
	
	public function addRecipient($recipient)
	{
		array_push($this->recipients,$recipient);
	}
	
	public function setFrom($from)
	{
		$this->from = $from;
	}
	
	public function setSubject($subject)
	{
		$this->subject = $subject;
	}
	
	public function setMessageBody($messageBody)
	{
		$this->messageBody = $messageBody;
	}
	
	public function addStyle($style)
	{
		array_push($this->styles,$style);
	}
	
	public function send()
	{
		$to = "";
		foreach ($this->recipients as $recipient)
		{
			$to .= $recipient.',';
		}
		$to = substr($to,0,-1);
		
		$headers  = 'MIME-Version: 1.0'."\n";
		$headers .= 'Content-type: text/html; charset=iso-8859-1'."\n";
		$headers .= 'From: '.$this->from."\n";
		$messageHTML = "<html>\n<head><style type=\"text/css\">\n";
		foreach($this->styles as $style)
		{
			$messageHTML .= $style." \n";
		}
		$messageHTML .= "</style>\n</head>\n<body>\n";
//		echo $this->messageBody."<br>";
		$messageHTML .= $this->messageBody."\n</body>\n</html>";
		
				
		mail($to,$this->subject,$messageHTML,$headers);
	}
	
}

?>